<template>
  <div v-if="data">
    <div id="commentsmain" :style="{height:'230px'}">
    </div>
  </div>
</template>

<script>
import * as echarts from 'echarts';
export default {
name:'MyComment',
data(){
    return{
        data:null,
         url:'http://192.168.35.36:3005',
        sitem:{
          data:[],
          areaStyle:{},
          type:'line'
        }
    }
},
mounted(){

},
created(){
    this.$axios.get(`${this.url}/totaldata/comments`).then(content=>{
      this.data=content.data
      this.data.endarr.forEach(item=>{
        this.sitem.data.push(item.data)
      })
      
    }).then(()=>{
      var myChart = echarts.init(document.getElementById('commentsmain'));
        window.onresize = function() {
              myChart.resize();
        }
        myChart.setOption({
          title: {
              text: '近一周评论状况'
           },
           tooltip: {},
           xAxis: {
            data: this.data.time
           },
           yAxis:{},
           series:this.sitem
        })
    })
}

}
</script>

<style>

</style>